package com.lhl.fw.db.entity;

import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.Setter;
import org.hibernate.annotations.CreationTimestamp;
import org.hibernate.annotations.UpdateTimestamp;

import javax.persistence.Column;
import javax.persistence.MappedSuperclass;
import java.io.Serializable;
import java.time.LocalDateTime;

/**
 * @className: com.lhl.fw.db.entity.AbstractAuditEntity
 * @description: 需要审计的属性字段
 * @author: king
 * @date: 2020-11-06
 */
@MappedSuperclass
@Getter
@Setter
public abstract class AbstractAuditEntity<ID extends Serializable> extends BaseEntity<ID> {
  /** @fields serialVersionUID */
  @SuppressWarnings("unused")
  private static final long serialVersionUID = 1L;

  /** 创建时间 */
  @CreationTimestamp
  @Column(name = "CREATE_DATE", insertable = true, updatable = false)
  @ApiModelProperty(value = "创建时间", hidden = true)
  private LocalDateTime createDateTime;

  /** 最后修改时间 */
  @UpdateTimestamp
  @Column(name = "UPDATE_DATE", insertable = false, updatable = true)
  @ApiModelProperty(value = "更新时间", hidden = true)
  private LocalDateTime updateDateTime;

  /** 创建人 */
  @Column(name = "CREATE_BY", length = 700, insertable = true, updatable = false)
  @ApiModelProperty(value = "创建人", hidden = true)
  private String createBy;

  /** 最后修改人 */
  @Column(name = "UPDATE_BY", length = 700, insertable = false, updatable = true)
  @ApiModelProperty(value = "更新人", hidden = true)
  private String updateBy;
}
